

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=&#34;auto&#34;>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" type="image/png" href="/img/favicon.png">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="">
  <meta name="author" content="caoyusang">
  <meta name="keywords" content="">
  <title>Docker-Desktop-Installation-On-Windows - caoyusang的科研日常</title>

  <link  rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.staticfile.org/github-markdown-css/4.0.0/github-markdown.min.css" />
  <link  rel="stylesheet" href="/lib/hint/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.staticfile.org/highlight.js/10.0.0/styles/github-gist.min.css" />
    
  

  


<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_kmeydafke9r.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 5.2.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>caoyusang</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" data-toggle="modal" data-target="#modalSearch">&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;</a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" href="javascript:">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner intro-2" id="background" parallax=true
         style="background: url('/img/7.jpg') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="container page-header text-center fade-in-up">
            <span class="h2" id="subtitle">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2021-05-28 19:02" pubdate>
        2021年5月28日 晚上
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      355 字
    </span>
  

  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      5
       分钟
    </span>
  

  
  
    
      <!-- 不蒜子统计文章PV -->
      <span id="busuanzi_container_page_pv" style="display: none">
        <i class="iconfont icon-eye" aria-hidden="true"></i>
        <span id="busuanzi_value_page_pv"></span> 次
      </span>
    
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid">
  <div class="row">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-md">
      <div class="container nopadding-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto" id="post">
            <!-- SEO header -->
            <h1 style="display: none">Docker-Desktop-Installation-On-Windows</h1>
            
              <p class="note note-info">
                
                  本文最后更新于：1 小时前
                
              </p>
            
            <div class="markdown-body" id="post-body">
              <h2 id="Docker-Desktop-Installation-For-Windows"><a href="#Docker-Desktop-Installation-For-Windows" class="headerlink" title="Docker Desktop Installation For Windows"></a>Docker Desktop Installation For Windows</h2><h3 id="1-启用Windows的Hyper-V功能"><a href="#1-启用Windows的Hyper-V功能" class="headerlink" title="1.启用Windows的Hyper-V功能"></a>1.启用Windows的Hyper-V功能</h3><h4 id="控制面板-gt-程序"><a href="#控制面板-gt-程序" class="headerlink" title="控制面板-&gt;程序"></a>控制面板-&gt;程序</h4><img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524210324325.png" srcset="/img/loading.gif" class="">
<h4 id="打开Hyper-V功能"><a href="#打开Hyper-V功能" class="headerlink" title="打开Hyper-V功能"></a>打开Hyper-V功能</h4><img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524210509915.png" srcset="/img/loading.gif" class="">
<h4 id="重启电脑"><a href="#重启电脑" class="headerlink" title="重启电脑"></a>重启电脑</h4><img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524210552217.png" srcset="/img/loading.gif" class="">
<h3 id="2-下载"><a href="#2-下载" class="headerlink" title="2.下载"></a>2.下载</h3><p><a target="_blank" rel="noopener" href="https://www.docker.com/get-started">Docker Desktop For Windows</a></p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524210053456.png" srcset="/img/loading.gif" class="">
<h3 id="2-安装"><a href="#2-安装" class="headerlink" title="2.安装"></a>2.安装</h3><img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524211212591.png" srcset="/img/loading.gif" class="">
<h3 id="3-配置阿里云镜像加速"><a href="#3-配置阿里云镜像加速" class="headerlink" title="3.配置阿里云镜像加速"></a>3.配置阿里云镜像加速</h3><p><a target="_blank" rel="noopener" href="https://www.aliyun.com/product/acr">阿里云容器镜像服务ACR</a></p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524211701661.png" srcset="/img/loading.gif" class="">
<p><code>创建个人实例</code></p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524211747724.png" srcset="/img/loading.gif" class="">
<p><code>获取镜像加速地址</code></p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524211826770.png" srcset="/img/loading.gif" class="">
<p><code>在Docker Desktop设置中配置阿里云镜像源</code></p>
<ul>
<li><p>打开设置</p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524212345836.png" srcset="/img/loading.gif" class="">
</li>
<li><p>打开具体Docker Engine设置</p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524212403632.png" srcset="/img/loading.gif" class="">
</li>
<li><p>配置镜像源</p>
<p>用我的也行: <a target="_blank" rel="noopener" href="https://x4izdw0s.mirror.aliyuncs.com">https://x4izdw0s.mirror.aliyuncs.com</a></p>
</li>
</ul>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524212037010.png" srcset="/img/loading.gif" class="">
<h3 id="4-Docker图形化工具Portainer的使用"><a href="#4-Docker图形化工具Portainer的使用" class="headerlink" title="4.Docker图形化工具Portainer的使用"></a>4.Docker图形化工具Portainer的使用</h3><ul>
<li><p>下载portainer/portainer镜像</p>
<pre><code class="hljs shell">docker pull portainer/portainer</code></pre>
</li>
<li><p>运行Portainer容器</p>
<p><code>配置解释</code></p>
<ul>
<li>-p port:port —— 端口映射</li>
<li>—name container_name —— 指定容器的名字</li>
<li>—restart=always —— 以守护(后台)进程的方式运行</li>
<li>-v —— 将容器目录挂载到宿主机的对应路径</li>
<li>-d —— 后台运行容器，并返回容器ID</li>
</ul>
<pre><code class="hljs reStructuredText">docker run -p 9000:9000 -p 8000:8000 --name portainer \
--restart&#x3D;always \
-v &#x2F;var&#x2F;run&#x2F;docker.sock:&#x2F;var&#x2F;run&#x2F;docker.sock \
-v &#x2F;mydata&#x2F;portainer&#x2F;data:&#x2F;data \
-d portainer&#x2F;portainer</code></pre>
<p><code>可执行命令行</code></p>
<pre><code class="hljs shell">docker run -p 9000:9000 -p 8000:8000 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v /mydata/portainer/data:/data -d portainer/portainer</code></pre>
</li>
<li><p><a target="_blank" rel="noopener" href="http://localhost:9000">访问本机的9000端口</a></p>
</li>
<li><p>首次登陆设置root账号</p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524214031759.png" srcset="/img/loading.gif" class="">
</li>
<li><p>选择管理本地的Docker环境</p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524214112064.png" srcset="/img/loading.gif" class="">
</li>
<li><p>管理本地的Docker环境</p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524214326594.png" srcset="/img/loading.gif" class="">
</li>
<li><p>App Templates —— 支持快速生成常用的容器</p>
<p>以运行一个Nginx容器为例，完成如下设置后，即可运行容器。</p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524214638158.png" srcset="/img/loading.gif" class="">
<p><a target="_blank" rel="noopener" href="http://localhost:80">访问80端口</a></p>
<img src="/2021/05/28/Docker-Desktop-Installation-On-Windows/image-20210524214743757.png" srcset="/img/loading.gif" class="">
</li>
</ul>

            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                  <div class="post-meta mr-3">
                    <i class="iconfont icon-category"></i>
                    
                      <a class="hover-with-bg" href="/categories/%E5%AE%89%E8%A3%85/">安装</a>
                    
                  </div>
                
                
                  <div class="post-meta">
                    <i class="iconfont icon-tags"></i>
                    
                      <a class="hover-with-bg" href="/tags/docker/">docker</a>
                    
                  </div>
                
              </div>
              
                <p class="note note-warning">本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！</p>
              
              
                <div class="post-prevnext row">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2021/05/28/DockerBasicCommands/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">DockerBasicCommands</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2021/05/03/TX%E7%AC%94%E8%AF%95/">
                        <span class="hidden-mobile">TX笔试</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div id="tocbot"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    
  </main>

  
    <a id="scroll-top-button" href="#" role="button">
      <i class="iconfont icon-arrowup" aria-hidden="true"></i>
    </a>
  

  
    <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
  

  

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
  </div>
  

  

  
</footer>

<!-- SCRIPTS -->
<script  src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js" ></script>
<script  src="https://cdn.staticfile.org/twitter-bootstrap/4.4.1/js/bootstrap.min.js" ></script>
<script  src="/js/debouncer.js" ></script>
<script  src="/js/main.js" ></script>

<!-- Plugins -->


  
    <script  src="/js/lazyload.js" ></script>
  



  



  <script defer src="https://cdn.staticfile.org/clipboard.js/2.0.6/clipboard.min.js" ></script>
  <script  src="/js/clipboard-use.js" ></script>



  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>





  <script  src="https://cdn.staticfile.org/tocbot/4.11.1/tocbot.min.js" ></script>
  <script>
    $(document).ready(function () {
      var boardCtn = $('#board-ctn');
      var boardTop = boardCtn.offset().top;

      tocbot.init({
        tocSelector: '#tocbot',
        contentSelector: '#post-body',
        headingSelector: 'h1,h2,h3,h4,h5,h6',
        linkClass: 'tocbot-link',
        activeLinkClass: 'tocbot-active-link',
        listClass: 'tocbot-list',
        isCollapsedClass: 'tocbot-is-collapsed',
        collapsibleClass: 'tocbot-is-collapsible',
        collapseDepth: 0,
        scrollSmooth: true,
        headingsOffset: -boardTop
      });
      if ($('.toc-list-item').length > 0) {
        $('#toc').css('visibility', 'visible');
      }
    });
  </script>



  <script  src="https://cdn.staticfile.org/typed.js/2.0.11/typed.min.js" ></script>
  <script>
    var typed = new Typed('#subtitle', {
      strings: [
        '  ',
        "Docker-Desktop-Installation-On-Windows&nbsp;",
      ],
      cursorChar: "_",
      typeSpeed: 70,
      loop: false,
    });
    typed.stop();
    $(document).ready(function () {
      $(".typed-cursor").addClass("h2");
      typed.start();
    });
  </script>



  <script  src="https://cdn.staticfile.org/anchor-js/4.2.2/anchor.min.js" ></script>
  <script>
    anchors.options = {
      placement: "right",
      visible: "hover",
      
    };
    var el = "h1,h2,h3,h4,h5,h6".split(",");
    var res = [];
    for (item of el) {
      res.push(".markdown-body > " + item)
    }
    anchors.add(res.join(", "))
  </script>



  <script  src="/js/local-search.js" ></script>
  <script>
    var path = "/local-search.xml";
    var inputArea = document.querySelector("#local-search-input");
    inputArea.onclick = function () {
      searchFunc(path, 'local-search-input', 'local-search-result');
      this.onclick = null
    }
  </script>



  <script  src="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.staticfile.org/fancybox/3.5.7/jquery.fancybox.min.css" />

  <script>
    $('#post img:not(.no-zoom img, img[no-zoom]), img[zoom]').each(
      function () {
        var element = document.createElement('a');
        $(element).attr('data-fancybox', 'images');
        $(element).attr('href', $(this).attr('src'));
        $(this).wrap(element);
      }
    );
  </script>





  

  
    <!-- MathJax -->
    <script>
      MathJax = {
        tex: {
          inlineMath: [['$', '$'], ['\\(', '\\)']]
        },
        options: {
          renderActions: {
            findScript: [10, doc => {
              document.querySelectorAll('script[type^="math/tex"]').forEach(node => {
                const display = !!node.type.match(/; *mode=display/);
                const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display);
                const text = document.createTextNode('');
                node.parentNode.replaceChild(text, node);
                math.start = { node: text, delim: '', n: 0 };
                math.end = { node: text, delim: '', n: 0 };
                doc.math.push(math);
              });
            }, '', false],
            insertedScript: [200, () => {
              document.querySelectorAll('mjx-container').forEach(node => {
                let target = node.parentNode;
                if (target.nodeName.toLowerCase() === 'li') {
                  target.parentNode.classList.add('has-jax');
                }
              });
            }, '', false]
          }
        }
      };
    </script>

    <script async src="https://cdn.staticfile.org/mathjax/3.0.5/es5/tex-svg.js" ></script>

  











</body>
</html>
